package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum AskforLogTypeEnum {
    /**
     * 类型（1.创建,2.确认,3.寄回,4.收货,5.退款,6.完成,7.取消）
     */
    ASKFOR_LOG_TYPE_CREATE(1, "创建"),
    ASKFOR_LOG_TYPE_CONFIRM(2, "确认"),
    ASKFOR_LOG_TYPE_SHIPPING(3, "寄回"),
    ASKFOR_LOG_TYPE_RECEIVED(4, "收货"),
    ASKFOR_LOG_TYPE_REFUNDS(5, "退款"),
    ASKFOR_LOG_TYPE_COMPLETE(6, "完成"),
    ASKFOR_LOG_TYPE_CANCEL(6, "取消");

    private Integer id;
    private String name;

    AskforLogTypeEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        AskforLogTypeEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static AskforLogTypeEnum getById(Integer id) {
        for (AskforLogTypeEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

    public static void main(String args[]){
        System.out.println(AskforLogTypeEnum.getNameById(1));
    }
}
